package reversi;


import static org.junit.Assert.assertTrue;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class TestReversiServer {
	
	

	@Before
	public void setUp() throws Exception {
		rs = new ReversiServer();
		rs.addGame(new ReversiGame("Kopytko", "test", "apass"));
		rs.addGame(new ReversiGame("Domek", "cos", "apass"));
		
	}
	@Test
	public void testServerAndGame(){
		ReversiGame r=rs.getGame("Kopytko","apass");
		assertTrue(r.getName().equals("Kopytko"));
		r=rs.getGame("Domek", "apass");
		assertTrue(r.getName().equals("Domek"));
	}
	
	@Test
	public void testDeletingGames(){
		rs.deleteGame("test", "apass");
		try {
			Thread.sleep(15000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		assertTrue((rs.getGame("test", "apass")==null));
		
		
	}


	

	@After
	public void tearDown() throws Exception {
	}
	
	ReversiServer rs;

}
